<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="UTF-8">
<title>搜索会员</title>
$!{include("import_js_css.html")}
$!{include("import_tab_switch.html")}
</head>
<body class="panel-tologin-bg">
	$!{include("header.html")}
	<div class="container menu_all">
		<div class="tabbable tabs-left panel-db-cdt" id="div_ul_tab">
			$!{include("tab.html")}
			<div class="tab-content panel-radius-search-all panel-search">
				<div class="tab-pane active panel-search-cdts" id="panel-product">
					<div id="productFormGroup">
						<form class="form-horizontal" role="form" name="taskForm"
							action="yueyogaAdmin/searchMember.jhtml"
							method="post">
							<div id="product_search_cdts" class="form-group">
								<label for="inputName" class="col-sm-1 control-label">姓名</label>
								<div class="col-sm-3">
									<input type="text" class="form-control" name="name"
										id="inputName" value="${name}">
								</div>
								
								
								<label for="inputCardnumber" class="col-sm-1 control-label">编号</label>
								<div class="col-sm-3">
									<input type="text" class="form-control" name="cardnumber"
										id="inputCardnumber" value="${cardnumber}">
								</div>
								
								<br /> <br /> 
								<label for="inputPhone" class="col-sm-1 control-label">手机号</label>
								<div class="col-sm-3">	
									<input type="text" class="form-control" name="phone" id="inputPhone" value="${phone}">
								</div>

						
								<label for="outsideCardNo" class="col-sm-1 control-label">卡外码</label>
								<div class="col-sm-3">	
									<input type="text" class="form-control" name="outsideCardNo" id="outsideCardNo" value="${outsideCardNo}">
								</div>
								
								<br /> <br />
								
								<label for="inputMemberLevel" class="col-sm-1 control-label">手牌号</label>

								<div class="col-sm-3">
									<input type="text" class="form-control" name="shou"
										id="inputshou" value="${shou}" >
								</div>
								
								<label for="inputProductId" class="col-sm-1 control-label">卡项</label>
								<div class="col-sm-3">
									<!--#var(Status status, List<Status> memberStatus,List<Status> subStatuses)-->
									<select id="inputProductId" 
										class="selectpicker show-tick" data-width="100%" name="memberProductId">
										<option value=""> </option>
										<option value="">全部</option>
										<!-- #foreach(Product p in memberProducts) -->
											<option value="${p.productId}">${p.name}</option>
										<!-- #end -->
									</select>
								</div>
								
								<br /><br />
								<label for="memberStatus" class="col-sm-1 control-label">状态</label>
								<div class="col-sm-3">
									<!--#var(Status status, List<Status> memberStatus,List<Status> subStatuses)-->
									<select id="memberStatus" 
										class="selectpicker show-tick" data-width="100%" name="memberStatuCode">
										<option value=""> </option>	
										<option value="">全部</option>
										<!-- #foreach(status in memberStatus) -->
											<option value="${status.code}">${status.name}</option>
										<!-- #end -->
									</select>
								</div>
								<label for="infoSource" class="col-sm-1 control-label">信息来源</label>
								<div class="col-sm-3">
									<select id="infoSource" 
										class="selectpicker show-tick" data-width="100%" name="infoSource">
										<option value=""> </option>	
										<option value="">全部</option>
										<option value="81">电话打入</option>
										<option value="82">主动拜访</option>
										<option value="83">数据库</option>
										<option value="84">线上活动</option>
										<option value="85">线下活动</option>
										<option value="86">其他</option>
									</select>
								</div>
								<br></br>
								<label for="memberSubStatus" class="col-sm-1 control-label" >子状态</label>
								<div class="col-sm-3">
									<select id="memberSubStatus"  class="selectpicker show-tick" data-width="100%" name="substatus">
										<option value=""> </option>	
										<option value="">全部</option>
									<!-- #foreach(status in subStatuses) -->
										<option value="${status.code}">${status.name}</option>
									<!-- #end -->
									</select>
								</div>
								<label for="inputMarketingChannel" class="col-sm-1 control-label">市场渠道</label>
								<div class="col-sm-3">
									<!--#var(Status status, List<Status> marketingChannels,List<Status> subMarketingChannels)-->
									<select id="inputMarketingChannel"  class="selectpicker show-tick" data-width="100%" name="marketingChannel">
										<option value=""> </option>
										<option value="">全部</option>
										<!--#foreach(status in marketingChannels)-->
											<option value="${status.code}">${status.name}</option>
										<!-- #end -->
									</select>
								</div>
								<br /> <br />
								<label for="inputKeeper" class="col-sm-1 control-label" >会籍顾问</label>
								<div class="col-sm-3">
									<select id="inputKeeper" data-live-search="true" class="selectpicker show-tick" data-width="100%" name="keeper">
										<option value=""> </option>
										<option value="">全部</option>
										<!-- #for(GroupUserModel keepe : keeper) -->
											<option value="${keepe.id}">${keepe.name}</option>
										<!-- #end -->
									</select>
								</div>
								<label for="inputSubMarketingChannel" class="col-sm-1 control-label">子渠道</label>
								<div class="col-sm-3" style="margin-right:22px;">
									<select id="inputSubMarketingChannel"  class="selectpicker show-tick" data-width="100%" name="subMarketingChannel">
										<option value=""> </option>
										<option value="">全部</option>
										<!--#foreach(status in subMarketingChannels)-->
											<option value="${status.code}">${status.name}</option>
										<!-- #end -->
									</select>
								</div>
								<br /> <br />
								<label for="inputMinAge" class="col-sm-1 control-label">年龄组</label>
								<div class="col-sm-1">
									<input type="text" class="form-control" style="width:80px;" name="minAge" id="inputMinAge" value="${minAge}">
								</div>
								<label for="inputMaxAge" class="col-sm-1" style="width: 30px; margin-top:7px; margin-left:22px;font-weight:100;">至</label>
								<div class="col-sm-1">
									<input type="text" class="form-control" style="width:80px;" name="maxAge" id="inputMaxAge" value="${maxAge}">
								</div>
								<label for="inputMemberLevel" class="col-sm-1 control-label" style="margin-left:30px;">等级</label>
								<div class="col-sm-3">
									<select id="inputMemberLevel" 
										class="selectpicker show-tick" data-width="100%" name="memberLevel">
										<option value=""> </option>	
										<option value="">全部</option>
										<!-- #for(MemberLevel memberLevel : memberLevels) -->
											<option value="${memberLevel.memberLevelId}">${memberLevel.levelName}</option>
										<!-- #end -->
									</select>
								</div>
								</br><br />
								<label for="inputProvince" class="col-sm-1 control-label">所在省</label>
								<div class="col-sm-3">
									<!--#var(Area area,List<Area> provinces, List<Area> citys, List<Area> areas, List<Area> domains)-->
									<select id="inputProvince" data-live-search="true"
										class="selectpicker show-tick" data-width="100%" name="provinceId">
										<option value=""> </option>
										<option value="">全部</option>
										<!--#foreach(area in provinces)-->
											<option value="${area.areaId}">${area.name}</option>
										<!-- #end -->
									</select>
								</div>
								<label for="inputCity" class="col-sm-1 control-label">所在市</label>
								<div class="col-sm-3">
									<!-- #var(Area provinceArea) -->
									<select id="inputCity" data-live-search="true"
										class="selectpicker show-tick" data-width="100%" name="cityId">
										<option value=""> </option>
										<option value="">全部</option>
										<!--#foreach(area in citys)-->
											<option value="${area.areaId}">${area.name}</option>
										<!-- #end -->
									</select>
								</div>
								<br /> <br />
								<label for="inputArea" class="col-sm-1 control-label">所在区</label>
								<div class="col-sm-3">
									<!-- #var(Area cityArea) -->
									<select id="inputArea" data-live-search="true"
										class="selectpicker show-tick" data-width="100%" name="areaId">
										<option value=""> </option>
										<option value="">全部</option>
										<!--#foreach(area in areas)-->
											<option value="${area.areaId}">${area.name}</option>
										<!-- #end -->
									</select>
								</div>
								
								<label for="inputDomain  input-default" class="col-sm-1 control-label">所在域</label>
								<div class="col-sm-3">
									<!-- #var(Area parentArea) -->
									<select id="inputDomain" data-live-search="true"
										class="selectpicker show-tick" data-width="100%" name="domainId">
										<option value=""> </option>
										<option value="">全部</option>
										<!--#foreach(area in domains)-->
											<option value="${area.areaId}">${area.name}</option>
										<!-- #end -->
									</select>
								</div>
								
								<br /> <br />
								<label for="inputStartDate1" class="col-sm-1 control-label">创建时间</label>
								<div class="col-sm-3">
									<div id="inputStartDate1" class="input-group date"
										data-date-format="YYYY-MM-DD">
										<input id="inputStart1" name="startdate1" type='text' class="form-control" value="${startdate1}" />
										<span class="input-group-addon"><span
											class="glyphicon glyphicon-time"></span> </span>
									</div>
								</div>
								
								<div style="float:left;">至</div>
								
								<div class="col-sm-3" style="">
									<div id="inputStartDate2" class="input-group date"
										data-date-format="YYYY-MM-DD">
										<input id="inputStart2" name="startdate2" type='text' class="form-control" value="${startdate2}" />
										<span class="input-group-addon"><span
											class="glyphicon glyphicon-time"></span> </span>
									</div>
								</div> 
								<br /><br />
								
								
								<label for="total_absent" class="col-sm-1 control-label clear">累计未出席</label>
								<div class="col-sm-3">
									<select class="selectpicker show-tick" 
										data-width="100%" name="total_absent" id="total_absent">
										<option value=""> </option>
										<option value="">不限</option>
										<option value="7">一个周</option>
										<option value="30">一个月</option>
										<option value="60">两个月</option>
										<option value="90">三个月</option>
									</select>
								</div>
								
								<input type="hidden" name="pageNo" id="hidPageNo" />
								<input type="hidden" name="display" id="display" value="block"/>
								<div class="panel-db-search">
									<button id="btn_consume_search"  type="submit" class="btn btn-ade-default" style="margin-top:50px;">搜索</button>
								</div>
							</div>
						</form>
					</div>
					<script type="text/javascript">
						
						//会员状态
						$("#memberStatus").change(function() {
			
							var value = $(this).select2("val");
							if(value==null||value==""){
								var sub = document.getElementById("memberSubStatus");
								sub.options.length=0;
								option = new Option("全部", "");
								sub.options.add(option);
								return;
							}
							$.post(
								"yueyogaAdmin/substatus.jhtml",
								{"code": value},
								function(response) {
									var res = eval("(" + response + ")");
									if (res.success) {
										var option = null;
										var code = null;
										var name = null;
										var sub = document.getElementById("memberSubStatus");
										sub.options.length=0;
										option = new Option("全部", "");
										sub.options.add(option);
										for(var i=0;i<res.items.length;i++) {
											code = res.items[i].code;
											name = res.items[i].name;
											option = new Option(name, code);
											sub.options.add(option);
										}
									} else {
										alert(res.msg);
									}
								}
							);
						});
						
						//市场渠道
						$("#inputMarketingChannel").change(function() {
							var marketingChannel = $("#inputMarketingChannel").val();
							$.post(
								"yueyogaAdmin/substatus.jhtml",
								{"code": marketingChannel},
								function(response) {
									var res = eval("(" + response + ")");
									if (res.success) {
										var option = null;
										var code = null;
										var name = null;
										var sub = document.getElementById("inputSubMarketingChannel");
										sub.options.length=0;
										option = new Option("全部", "");
										sub.options.add(option);
										for(var i=0;i<res.items.length;i++) {
											code = res.items[i].code;
											name = res.items[i].name;
											option = new Option(name, code);
											sub.options.add(option);
										}
									} else {
										alert(res.msg);
									}
								}
							);
						});
						
						//省
						$("#inputProvince").change(function() {
							var parentId = $(this).val();
							$.post(
								"yueyogaAdmin/subArea.jhtml",
								{"level": "1", "parentId": parentId},
								function(response) {
									var sub = document.getElementById("inputCity");
									var res = eval("(" + response + ")");
									var id = null;
									var name = null;
									var option = null;
									sub.options.length=0;
									option = new Option("全部", "");
									sub.options.add(option);
									for(var i=0;i<res.items.length;i++) {
										id = res.items[i].areaId;
										name = res.items[i].name;
										option = new Option(name, id);
										sub.options.add(option);
									}
									var sub1 = document.getElementById("inputArea");
									sub1.options.length=0;
									option = new Option("全部", "");
									sub1.options.add(option);
									var sub2 = document.getElementById("inputDomain");
									sub2.options.length=0;
									option = new Option("全部", "");
									sub2.options.add(option);
								}
							);
						});
						
						//市
						$("#inputCity").change(function() {
							var parentId = $(this).val();
							$.post(
								"yueyogaAdmin/subArea.jhtml",
								{"level": "2", "parentId": parentId},
								function(response) {
									var sub = document.getElementById("inputArea");
									var res = eval("(" + response + ")");
									var id = null;
									var name = null;
									var option = null;
									sub.options.length=0;
									option = new Option("全部", "");
									sub.options.add(option);
									for(var i=0;i<res.items.length;i++) {
										id = res.items[i].areaId;
										name = res.items[i].name;
										option = new Option(name, id);
										sub.options.add(option);
									}
									var sub2 = document.getElementById("inputDomain");
									sub2.options.length=0;
									option = new Option("全部", "");
									sub2.options.add(option);
								}
							);
						});
						
						//区
						$("#inputArea").change(function() {
							var parentId = $(this).val();
							$.post(
								"yueyogaAdmin/subArea.jhtml",
								{"level": "3", "parentId": parentId},
								function(response) {
									var sub = document.getElementById("inputDomain");
									var res = eval("(" + response + ")");
									var id = null;
									var name = null;
									var option = null;
									sub.options.length=0;
									option = new Option("全部", "");
									sub.options.add(option);
									for(var i=0;i<res.items.length;i++) {
										id = res.items[i].areaId;
										name = res.items[i].name;
										option = new Option(name, id);
										sub.options.add(option);
									}
								}
							);
						});
						
						$(document).ready(function(){
							//去掉搜索框
							$("#memberStatus").select2({
								width: "100%",
								minimumResultsForSearch: -1
							});
							$("#memberSubStatus").select2({
								width: "100%",
								minimumResultsForSearch: -1
							});
							
							$("#inputMarketingChannel").select2({
								width: "100%",
								minimumResultsForSearch: -1
							});
							
							$("#inputSubMarketingChannel").select2({
								width: "100%",
								minimumResultsForSearch: -1
							});
							
							$("#inputMemberLevel").select2({
								width: "100%",
								minimumResultsForSearch: -1
							});
							
							//市区域去掉搜索框
							$("#inputCity").select2({
								width: "100%",
								minimumResultsForSearch: -1
							});
							
							$("#inputArea").select2({
								width: "100%",
								minimumResultsForSearch: -1
							});
							
							$("#inputDomain").select2({
								width: "100%",
								minimumResultsForSearch: -1
							});
							
							$("#inputProvince").select2('val', '${provinceId}');
							$("#inputCity").select2('val', '${cityId}');
							$("#inputArea").select2('val', '${areaId}');
							$("#inputDomain").select2('val', '${domainId}');
							
							$("#memberStatus").select2('val', '${statusCode}');
							$("#memberSubStatus").select2('val', '${substatus}');
							
							$("#inputMarketingChannel").select2('val', '${marketingChannelCode}');
							$("#inputSubMarketingChannel").select2('val', '${subMarketingChannel}');
							
							$("#inputKeeper").select2('val', '${keeperId}');
							$("#inputMemberLevel").select2('val', '${memberLev}');
							$("#total_absent").select2("val","${totalAbsent}");
							
							//最小年龄判断只能输入数字
							$("#inputMinAge").keyup(function(){
								var comment = $("#inputMinAge").val();
								var reg = /^\d+$/;
								if(!reg.test(comment)){
									$("#inputMinAge").val('${minAge}');
								}else{}
								
							});
							//最大年龄判断只能输入数字
							$("#inputMaxAge").keyup(function(){
								var comment = $("#inputMaxAge").val();
								var reg = /^\d+$/;
								if(!reg.test(comment)){
									$("#inputMaxAge").val('${maxAge}');
								}else{}
							});
						});
					</script>
				</div>
			</div>
		</div>
		<div class="div_search_result clear">$!{include("member_list.html")}</div>
	</div>
</body>
<script type="text/javascript">
$(function(){
	$("#inputStartDate1").datetimepicker({
		language : "zh-CN"
	});
	$("#inputStartDate2").datetimepicker({
		language : "zh-CN"
	});
	$(".div_search_result").hide();
	var display = "${display}";
	if("block"==display){
		$(".div_search_result").show();
	}
	var zysr = "${zysr}";
	if(zysr=="true"){
		$(".div_search_result").show();
	}
	
	$("#infoSource").select2({
		width: "100%",
		minimumResultsForSearch: -1
	});
	$("#infoSource").select2("val", "${infoSource}");
	$("#inputProductId").select2('val', '${memberProductId}');
});
</script>
</html>